﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SysManager_UserActionLog : BaseDataPage
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        this.Load += new System.EventHandler(Page_Load);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.txtsdate.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
            this.txtedate.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
            UserLoingLog();
            
        }
    }

    private void UserLoingLog()
    {
        string str = "";
        if (txtuser.Text != "")
        {
            str += " and usercode like '%" + txtuser.Text + "%' or username like '%" + txtuser.Text + "%'";
        }
        if (txtsdate.Text == "" || txtedate.Text == "")
        {
            this.txtsdate.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
            this.txtedate.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
        }
        str += "  and acdatetime >='" + this.txtsdate.Text + "' and acdatetime <='" + this.txtedate.Text + "'";
        string sql = @"select * from v_useractionmsg
                    where 1=1"+str +" order by acdatetime desc ";
        this.GridView1.DataSource = mydb.DM_GetDateSet(sql);
        this.GridView1.DataBind();
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        UserLoingLog();
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        UserLoingLog();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        UserLoingLog();
    }
}